<!DOCTYPE html>
<html>
<head>
    <!--[if lt IE 7]>
    <div class="ie6_error">还在用<strong>漏洞百出的IE6浏览器</strong>么？为了您的网络安全，请升级浏览器 <a target="_blank"
                                                                               href="http://browsehappy.com">立即升级</a>
    </div>
    <![endif]-->

    <meta charset="utf-8">
    <title>订单管理-普通订单-文具1号</title>
    <meta name="description"
          content="文具1号作为上海办公用品供货商公司,专为世界500强企业及SOHO办公族提供网上商城一站式办公耗材批发及采购服务,一站式选购办公日用文具用品,厂家直销,好货又便宜【阳光采购就上文具1号 阳光价格 老板放心 品质保障 员工省力】"/>
    <meta name="keywords" content="办公用品,办公文具,办公文具网站,文具网站,办公用品网,文具采购网,金万年"/>
    <meta name="copyright" content="上海易推信息科技有限公司"/>
    <meta name="renderer" content="webkit">
    <base href="<?php echo base_url(); ?>"/>
    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="stylesheet" href="public/js/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="public/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/list_bought.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/order-manage.css"/>
    <!--[if lte IE 9]>
    <script type="text/javascript" src="public/js/html5shiv-printshiv-3.js"></script>
    <![endif]-->
</head>
<body>
<div class="bg">
    <!--common - head -->
    <?php $this->load->view('common/header.php');?>

    <!--common - head end-->

    <div class="container mt20">
        <div class="order-manage-container">
            <p class="path-tit">
                <em class="color-red">订单管理</em>＞普通订单
            </p>
            <div class="order-manage-cont">
                <div id="main-content">

                    <div class="bought-list">
                        <form class="skin-gray clearfix bought-search" action="<?php echo base_url(); ?>order/common_order" method="get">
                            <div class="remide-box" gdata-spm="7">
                                <h3>我的交易提醒：</h3>
                                <ul>
                                    <li>
                                        <a href="<?php echo base_url(); ?>order/common_order?id=4"
                                           <?php if ($id == 4): ?>class="select"<?php endif;?>>待付款<span class="num">(<?=$count_daifukuan?>)</span></a></li>
                                    <li>
                                        <a href="<?php echo base_url(); ?>order/common_order?id=3"
                                           <?php if ($id == 3): ?>class="select"<?php endif;?>>待确认收货<span class="num">(<?=$count_daiqueren?>)</span></a>
                                    </li>
                                </ul>
                                <button class="J_MakePoint button search-btn" type="submit" id="searchBtn">
                                    搜索
                                </button>
                                <input type="text" size="50" id="J_BaobeiName" name="order_bn" value="<?=$order_bn?>" placeholder="搜索订单号" maxlength="30">
                            </div>
                        </form>
                        <form action="" method="post" id="J_BoughtListForm">
                            <input id="J_Token" type="hidden" name="_tb_token_" value="gUF4t3NQyTm">
                            <div class="navfloat" style="position:relative">
                            </div>
                            <table class="bought-table" id="J_BoughtTable">
                                <colgroup>
                                    <col class="selector">
                                    <col class="baobei">
                                    <col class="price">
                                    <col class="price">
                                    <col class="price">
                                    <col class="quantity">
                                    <col class="price">
                                    <col class="after-service">

                                    <col class="trade-status">
                                    <col class="operate">
                                </colgroup>
                                <thead id="list-table-th" class="list-table-th">
                                <tr class="col-name">
                                    <th></th>
                                    <th class="baobei" style="text-align: left">商品信息</th>
                                    <th class="price">单价(元)</th>
                                    <th class="quantity">优惠</th>
                                    <th class="price">现价</th>
                                    <th class="price">数量</th>
                                    <th class="quantity">实付款</th>
                                    <!--                                    <th class="after-service">包裹</th>-->
                                    <th></th>
                                    <th class="trade-status">
                                        <div class="trade-status">
                                            <select class="trade-status-select" onchange="s_click(this)">
                                                <option value="" <?php if ($id == ""): ?>selected<?php endif;?>>全部
                                                </option>
                                                <option value="4" <?php if ($id == 4): ?>selected<?php endif;?>>
                                                    等待买家付款
                                                </option>
                                                <option value="2" <?php if ($id == 2): ?>selected<?php endif;?>>买家已付款
                                                </option>
                                                <option value="3" <?php if ($id == 3): ?>selected<?php endif;?>>卖家已发货
                                                </option>
                                                <option value="1" <?php if ($id == 1): ?>selected<?php endif;?>>交易成功
                                                </option>
                                                <option value="0" <?php if ($id == "0"): ?>selected<?php endif;?>>
                                                    交易关闭
                                                </option>
                                                <option value="6" <?php if ($id == 6): ?>selected<?php endif;?>>
                                                    退款中的订单
                                                </option>
                                            </select>
                                        </div>
                                    </th>
                                    <th class="remark">交易操作</th>
                                </tr>
                                <?php if($list):?>
                                <tr class="toolbar ">
                                    <td colspan="8">
                                    <td class="last-col" colspan="2">
                                        <div class="paginator-top">
                                            <?php if($p > 1):?>
                                            <div class="paginator-next paginator-prev g-u preurl">上一页<span class="paginator-arrow paginator-arrow-right-grey"></span></div>
                                            <?php endif;?>
                                            <?php if($p < $num):?>
                                             <div class="paginator-next g-u nexturl">下一页<span class="paginator-arrow paginator-arrow-right-grey"></span></div>
                                            <?php endif;?>
                                        </div>
                                    </td>
                                </tr>
                                <?php endif;?>
                                </thead>
                                <?php if($list):?>
                                <tbody gdata-isarchive="false" gdata-status="WAIT_BUYER_PAY" class="xcard">
                                <?php foreach ($list as $vo): ?>
                                    <tr class="order-hd">
                                        <td colspan="10">
                                        <span class="no">
                                        <label>
                                          <span class="g-u"> </span>

                                          订单编号：<span class="order-num"><?=$vo['order_bn']?></span>
                                        </label>
                                        </span>
                                          <span class="deal-time">下单时间：<?=$vo['order_at']?></span>
                                            <?php if($vo['complated_at']):?>
                                            <span class="deal-time">成交时间：<?=$vo['complated_at']?></span>
                                            <?php endif;?>
                                            <span class="seller">
                                            <a target="_blank" class="nickname J_MakePoint" title="文具1号超市"
                                               href="<?php echo base_url('office'); ?>">文具1号超市</a>
                                        </span>
                                        </td>
                                    </tr>
                                    <?php foreach ($vo['detail']['products'] as $key => $bo): ?>
                                        <tr class="order-bd last" data-gid="10518" data-gcount="1">
                                            <td class="baobei" colspan="2">
                                                <a target="_blank" hidefocus="true" title="查看商品详情"
                                                   href="<?php echo base_url('goods/detail'); ?>?id=<?php echo $bo['product_id']; ?>" class="pic s50">
                                                    
                                                   
                                                    <img alt="查看商品详情" src="<?=$bo['product_img']?>">
                                                </a>

                                                <div class="desc">
                                                    <a class="baobei-name" target="_blank"
                                                       href="<?php echo base_url(); ?>goods/detail?id=<?=$bo['product_id']?>">
                                                        <?=$bo['product_name']?> </a>
                                                    <div class="spec">
                                                        <?php foreach ($bo['sku_info'] as $k => $v): ?>
                                                            <span><?=$k?> : <?=$v?>&nbsp;&nbsp;</span>
                                                        <?php endforeach;?>
                                                    </div>
                                                </div>
                                            </td>
                                            <td class="price oprice"><?=$bo['price']?></td>
                                            <td class="quantity"><?=($bo['price'] - $bo['final_price']) * $bo['count']?></td>
                                            <td class="price"><?=$bo['final_price']?></td>
                                            <td class="price"><?=$bo['count']?></td>

                                            <?php if ($key == 0): ?>
                                                <td class="quantity" rowspan="<?=count($vo['detail']['products'])?>"><?=$vo['money']?>
                                                    <br><em class="color-gray">（含快递<?=$vo['express_fee']?>）</em></td>

                                            <?php endif;?>
                                            <td class="pro-box" rowspan="">
                                                
                                                <?php if($vo['status'] == 1):?>
                                                    <?php if($vo['detail']['products'][$key]['refundinfo'] == ""):?>
                                                        <a class="J_DelOrder J_MakePoint color-blue" target="_blank" href="<?=$this->config->item('shop_url')?>bBOrder-returnmoeny.html&orderId=<?php echo $vo['shop_order_id']?>&goodsId=<?=$bo['product_id']?>">申请售后</a>
                                                    <?php elseif($vo['detail']['products'][$key]['refundinfo'] == "退款申请中"):?>
                                                        <a class="J_DelOrder J_MakePoint color-red" href="<?=$this->config->item('shop_url')?>index.php?app=member/BOrder&act=returnmoeny&orderId=<?php echo $vo['shop_order_id']?>&goodsId=<?=$bo['product_id']?>">退款申请中</a>
                                                    <?php elseif($vo['detail']['products'][$key]['refundinfo'] == "退款成功"):?>
                                                        <a class="J_DelOrder J_MakePoint color-red" href="javascript:;">退款成功</a>
                                                    <?php endif;?>
                                                <?php elseif($vo['status'] == 2 || $vo['status'] == 3):?>
                                                    <?php if($vo['detail']['products'][$key]['refundinfo'] == ""):?>
                                                        <a class="J_DelOrder J_MakePoint color-blue" target="_blank" href="<?=$this->config->item('shop_url')?>bBOrder-returnmoeny.html&orderId=<?php echo $vo['shop_order_id']?>&goodsId=<?=$bo['product_id']?>">退货/退款</a>
                                                    <?php elseif($vo['detail']['products'][$key]['refundinfo'] == "退款申请中"):?>
                                                        <a class="J_DelOrder J_MakePoint color-red" href="<?=$this->config->item('shop_url')?>index.php?app=member/BOrder&act=returnmoeny&orderId=<?php echo $vo['shop_order_id']?>&goodsId=<?=$bo['product_id']?>">退款申请中</a>
                                                    <?php elseif($vo['detail']['products'][$key]['refundinfo'] == "退款成功"):?>
                                                        <a class="J_DelOrder J_MakePoint color-red" href="javascript:;">退款成功</a>
                                                    <?php endif;?>
                                                <?php endif;?>
                                            </td>
                                            <?php if ($key == 0): ?>
                                                <td class="trade-status" rowspan="<?=count($vo['detail']['products'])?>">
                                                    <?php if($vo['status']==0):?>
                                                        <span class="J_MakePoint status closed" target="_blank">关闭交易</span>
                                                    <?php elseif($vo['status']==1):?>
                                                        <span class="J_MakePoint status closed" target="_blank">交易成功</span>
                                                    <?php elseif($vo['status']==2):?>
                                                        <span class="J_MakePoint status closed" target="_blank">买家已付款</span>

                                                    <?php elseif($vo['status']==3):?>
                                                        <span class="J_MakePoint status closed" target="_blank">卖家已发货</span>
                                                    <?php elseif($vo['status']==4):?>
                                                        <span class="J_MakePoint status closed" target="_blank">等待买家付款</span>
                                                    <?php elseif($vo['status']==5):?>
                                                        <span class="J_MakePoint status closed" target="_blank">交易结束</span>
                                                    <?php elseif($vo['status']==6):?>
                                                        <span class="J_MakePoint status closed" target="_blank">退货中</span>
                                                    <?php elseif($vo['status']==7):?>
                                                        <span class="J_MakePoint status closed" target="_blank">已退货</span>
                                                    <?php endif;?>
                                                    
                                                    <span>
                                                        <a href="<?php echo base_url()?>order/common?id=<?=$vo['id']?>" target="_blank" class="detail-link J_MakePoint color-blue">订单详情</a>
                                                    </span>
                                                </td>
                                                <td class="other" rowspan="<?=count($vo['detail']['products'])?>">
                                                    
                                                    <?php if ($vo['status'] == 0): ?>
                                                        关闭交易
                                                    <?php elseif ($vo['status'] == 1): ?>
                                                        交易成功
                                                    <?php elseif ($vo['status'] == 2): ?>
                                                        <a class="J_DelOrder J_MakePoint color-blue" target="_blank" target="_blank" href="<?=$this->config->item('shop_url')?>bBOrder.html">取消订单</a>
                                                    <?php elseif ($vo['status'] == 3): ?>
                                                        <a class="J_DelOrder J_MakePoint confirm-receipt" target="_blank" href="<?=$this->config->item('shop_url')?>bBOrder.html">确认收货</a>
                                                        <a class="J_DelOrder J_MakePoint color-blue" target="_blank" target="_blank" href="<?=$this->config->item('shop_url')?>bBOrder.html">取消订单</a>
                                                    <?php elseif ($vo['status'] == 4): ?>
                                                        <a class="J_DelOrder J_MakePoint color-blue" target="_blank" target="_blank" href="<?=$this->config->item('shop_url')?>bBOrder.html">取消订单</a>
                                                        <a class="J_DelOrder J_MakePoint confirm-receipt " target="_blank" href="<?=$this->config->item("shop_url").'bBPayment-mergeOrders.html&orderId='.$vo['shop_order_id']?>">去付款</a>
                         
                                                    <?php elseif ($vo['status'] == 5): ?>
                                                        交易结束
                                                    <?php elseif ($vo['status'] == 6): ?>
                                                        退货中
                                                    <?php elseif ($vo['status'] == 7): ?>
                                                        已退货
                                                    <?php endif;?>

                                                </td>
                                            <?php endif;?>
                                        </tr>
                                    <?php endforeach;?>
                                <?php endforeach;?>
                                </tbody>
                               
                                <tfoot>
                                <tr class="sep-row">
                                    <td colspan="8"></td>
                                </tr>
                                <tr class="toolbar skin-gray">
                                    <td colspan="2">
                                    </td>

                                    <td class="page-nav-cell" colspan="8">
                                        <div id="demo7" style="text-align: right"></div>
                                    </td>
                                </tr>
                                </tfoot>
                                 <?php else:?>
                                    <tbody style="border: none;">
                                        <tr>
                                            <td colspan="10" style="text-align: center;font-size: 15px;color: grey; border: none;height: 250px;line-height: 250px;">
                                                暂无订单，您可以 <a target="_blank" href="<?=base_url()?>office" style="color: blue;">去购物</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                <?php endif;?>
                            </table>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <?php $this->load->view('common/bottom.php');?>
</div>

<script type="text/javascript" src="public/js/jquery.min.js"></script>
<script type="text/javascript" src="public/js/index.js"></script>
<script type="text/javascript" src="public/js/owl.carousel.min.js"></script>
<script src="public/js/layui/layui.js"></script>
<script type="text/javascript">
    layui.use('laypage', function () {
        var laypage = layui.laypage;

        //完整功能
        laypage.render({
            elem: 'demo7'
            , count: "<?=$num?>" * 10
            , layout: ['prev', 'page', 'next', 'skip']
            , curr: <?=$p?> //获取起始页
            , jump: function (obj, first) {
                var id = "<?=$id?>";
                if (!first) {
                    location.href = '<?php echo base_url(); ?>order/common_order?p=' + obj.curr + '&id=' + id;
                }
            }
        });

    });

    $(function () {
        $(".workbench-edit-btn-change").click(function () {
            $(this).parent().hide();
            $(".company-type2").show();
        });
        $(".workbench-edit-btn-submit").click(function () {
            var companyName = $(".company-name-input").val();
            console.log(companyName);
            if (!companyName) {
                alert("请输入公司全称");
                return false
            } else {
                $(this).parent().hide();
                $(".company-type1").show();
                $('.company-name').html(companyName)
            }

        });

        $('#J_AllSelector,#J_AllSelector2').click(function () {
            var _this = $(this);
            if (this.checked) {
                $('#J_AllSelector,#J_AllSelector2').prop("checked", true);
                $('input[name="order_id"]').each(function () {
                    //此处如果用attr，会出现第三次失效的情况
                    $(this).prop("checked", true);
                });
            } else {
                $('#J_AllSelector,#J_AllSelector2').prop("checked", false);
                $('input[name="order_id"]').each(function () {
                    $(this).removeAttr("checked", false);
                });
                //$(this).removeAttr("checked");
            }
        })

        $('.preurl').click(function () {
            var preurl = "<?=$preurl?>"
            location.href = preurl;
        })

        $('.nexturl').click(function () {
            var nexturl = "<?=$nexturl?>"
            location.href = nexturl;
        })
    });

    function s_click(obj) {
        var num = 0;
        for (var i = 0; i < obj.options.length; i++) {
            if (obj.options[i].selected == true) {
                num++;
            }
        }

        if (num == 1) {
            var url = obj.options[obj.selectedIndex].value;
            var p = "<?=$p?>";
            if (url == '') {
                location.href = '<?php echo base_url(); ?>order/common_order?id=' + url;
            } else {
                location.href = '<?php echo base_url(); ?>order/common_order?id=' + url;

            }

        }
    }
</script>

</body>
</html>